-
-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add exception and warning constants #121
Add exception and warning constants #121
Conversation
…which are special snowflakes.
According to the docs, |
hpy/tools/autogen/public_api.h
Outdated
@@ -140,6 +208,8 @@ int HPy_RichCompareBool(HPyContext ctx, HPy v, HPy w, int op); | |||
|
|||
HPy_hash_t HPy_Hash(HPyContext ctx, HPy obj); | |||
|
|||
HPy HPy_Call(HPyContext ctx, HPy callable, HPy args, HPy kwargs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is worth being discussed (and probably this is not the correct place, we should open a separate issue): what signature do we want for HPy_Call
?
I don't think we want to force the user to create a tuple: I'm thinking of something along the lines of Py_VectorCall
in which you pass an array of HPy
and the number of arguments, which incidentally also matches the signature for our functions.
I think it's better to remove this from this PR (and deleting/skipping the UnicodeException tests, if they can't be implemented in any other way)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed it should be discussed. I like the idea of a signature a bit like our KEYWORDS method signature -- i.e. *args, nargs, kw
.
Happy to remove from here and start a new PR with what we decide -- perhaps I will just disable the test for the moment and we can enable it when Py_Call arrives.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HPy_Call
being discussed in #122.
…r since Python 3.3).
@antocuni HPy_Call removed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, apart the xfail vs skip
test/test_hpyerr.py
Outdated
@@ -200,6 +200,10 @@ def check_exception(cls): | |||
|
|||
def test_h_unicode_exceptions(self): | |||
import pytest | |||
pytest.xfail( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pypy's apptest don't support xfail. Can we just skip it instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens with the pytest.mark.xfail
in test_importing.py?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a completely different thing, in the best pypy tradition 🤦♂️
pytest.mark.*
are handled by pytest at collection time, so xfail works properly.
However, once you are inside the test it's a different story: since it's an apptest, the pytest
module which is imported inside the test is a dummy one which implements only skip
and raises
: see pypy/tool/pytest/objspace.py:maketestobjspace()
to see where the (dark) magic happens.
So to summarize: I withdraw my suggestion above, you can just use @pytest.mark.xfail
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woot. @pytest.mark.xfail
used instead.
This adds all the exceptions and warnings from Python's pyerrors.h, except:
The EnvironmentError and IOError aliases are tested from Python code.
It also adds:
It not longer adds HPy_Call and marks the unicode exception tests as expected failures until HPy_Call or similar exists.